//
//  ContactModel.swift
//  EarbudsDatabase
//
//  Created by 易先生 on 2024/5/24.
//

import Foundation
import RealmSwift
import MoyoungLib

public class ContactModel: Object, Storable {
    
    @Persisted(primaryKey: true) public var id: UUID
    
    @Persisted public var address: String = ""
    
    @Persisted public var date: Date = Date()
    
    @Persisted public var updateTime: Date = Date()
    
    @Persisted public var identifier: String = ""
        
    @Persisted public var firstName: String = ""
    
    @Persisted public var lastName: String = ""
        
    @Persisted public var phoneNumbers = List<String>()

    @Persisted public var organizationName: String = ""

    @Persisted public var selectPhoneNumber: String = ""
    
    @Persisted @objc public var fullName: String = ""
        
    @Persisted public var imageData: Data?
    
    public init(identifier: String, firstName: String, lastName: String, phoneNumbers: [String] = [], fullName: String,organizationName: String, selectPhoneNumber: String, imageData: Data? = nil) {
        super.init()
        self.identifier = identifier
        self.firstName = firstName
        self.lastName = lastName
        phoneNumbers.forEach { string in
            self.phoneNumbers.append(string)
        }
        self.organizationName = organizationName
        self.selectPhoneNumber = selectPhoneNumber
        self.fullName = fullName
        self.imageData = imageData
    }
    
    public override init() {
        super.init()
    }
}

